#include <iostream>
#include <memory>
using namespace std;


class Person
{
public:
    Person()
    {
        cout<<"Person()"<<endl;
    }
    ~Person()
    {
        cout<<"~Person()"<<endl;
    }
    public:
    void run()
    {
        cout<<"person run()"<<endl;
    }

};


int main()
{
    {    
        
        unique_ptr<Person>p2 = nullptr;
        p2->run();
        {
            unique_ptr<Person>p1(new Person);
            p1->run();
            /*Person对象的所有权转移到p2*/
            p2 = std::move(p1);
        }
        cout<<"aaaaaaaaaa"<<endl;
        p2->run();
        cout<<"bbbbbbbbbb"<<endl;


        #if 0
        unique_ptr<Person[]>p2(new Person[3]{});//解决数组问题
        #endif


    }
    return 0;
}